package com.jiaai.cloud.base.configurer;

import org.springframework.context.annotation.Configuration;

/**
 * Created by Administrator on 2017/8/29.
 */
@Configuration
public class QuartzConfig {
//    @Bean(name = "detailFactoryBean")
//    public MethodInvokingJobDetailFactoryBean detailFactoryBean(MatchScheduledTasks scheduledTasks){
//        MethodInvokingJobDetailFactoryBean bean = new MethodInvokingJobDetailFactoryBean ();
//        //这儿设置对应的Job对象
//        bean.setTargetObject (scheduledTasks);
//        //这儿设置对应的方法名  与执行具体任务调度类中的方法名对应
//        bean.setTargetMethod("work");
//        bean.setConcurrent(false);
//
//        return bean;
//    }
//
//    @Bean(name="cronTriggerBean")
//    public CronTriggerFactoryBean cronTriggerBean(MethodInvokingJobDetailFactoryBean detailFactoryBean){
//        CronTriggerFactoryBean trigger = new CronTriggerFactoryBean();
//        trigger.setJobDetail(detailFactoryBean.getObject ());
//        trigger.setStartDelay(0);
//        try {
//            trigger.setCronExpression("0 0/30 0-2 ? * *");
//        } catch (ParseException e) {
//            e.printStackTrace ();
//        }
//        return trigger;
//    }
//
//    @Bean
//    public SchedulerFactoryBean schedulerFactory(CronTriggerFactoryBean cronTriggerBean){
//        SchedulerFactoryBean schedulerFactory = new SchedulerFactoryBean ();
//       schedulerFactory.setTriggers(cronTriggerBean.getObject());
//        return schedulerFactory;
//    }
}
